﻿<%@ page import="com.cai.dao.GoodsDao" %>
<%@ page import="com.cai.dao.impl.GoodsDaoImpl" %>
<%@ page import="java.util.List" %>
<%@ page import="com.cai.entity.ItemType" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    GoodsDao goodsDao = new GoodsDaoImpl();
    List<ItemType> list = goodsDao.selectItemType();
    request.setAttribute("itemType", list);
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>器材列表</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="style/adminStyle.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="wrap">
    <div class="page-title">
        <span class="modular fl"><i class="add"></i><em>编辑/添加器材</em></span>
        <span class="modular fr"><a href="${pageContext.request.contextPath}/pageItems?page=1" class="pt-link-btn">器材列表</a></span>
    </div>
    <form action="<%=request.getContextPath()%>/itemInsert" method="post">
        <table class="list-style">
            <tr>
                <td style="text-align:right;width:15%;">器材名称：</td>
                <td><input type="text" name="item_name" value="${sessionScope.item_name_update}" class="textBox"/></td>
                <%session.removeAttribute("item_name_update");%>
            </tr>
            <tr>
                <td style="text-align:right;">器材分类：</td>
                <td>
                    <select class="textBox" name="item_type">
                        <%--c:foreach 循环--%>
                        <c:forEach var="item" items="${requestScope.itemType}">
                            <option value="${item.itemType_name}">${item.itemType_name}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
            <tr>
                <td style="text-align:right;">数量：</td>
                <td>
                    <input name="item_num" type="text" class="textBox"/>
                </td>
            </tr>
            <tr>
                <td style="text-align:right;">器材详情：</td>
                <td><textarea name="item_log" class="textarea" placeholder="编辑物品详情"></textarea></td>
            </tr>
            <tr>
                <td style="text-align:right;"></td>
                <td>
                    <input type="submit" value="添加/编辑器材" class="tdBtn"/>
                    <span style=" margin-left: 20px;color: red">${requestScope.errorLog}</span>
                </td>
            </tr>
        </table>
    </form>
</div>
</body>
</html>